package com.icloud.admin.domain;

import com.icloud.framework.domain.model.AuditingEntity;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.Entity;
import javax.persistence.EntityListeners;

/**
 * 系统资源
 *
 * @author cuiyl
 */
@Entity(name = "sys_resources")
@EntityListeners(AuditingEntityListener.class)
public class Resource extends AuditingEntity {

    private String name;//显示名称
    private String identifer;//识别名称
    private String category;//资源类型
    private String uri;
    private String method;
    private String description;
    private boolean enabled;


    public Resource() {
    }

    /**
     * 全参构造方法
     *
     * @param name
     * @param identifer
     * @param category
     * @param uri
     * @param method
     * @param description
     */
    public Resource(String name, String identifer, String category, String uri, String method, String description) {
        this.name = name;
        this.identifer = identifer;
        this.category = category;
        this.uri = uri;
        this.method = method;
        this.description = description;
    }

    /**
     * 更新属性
     *
     * @param name
     * @param identifer
     * @param category
     * @param uri
     * @param method
     * @param description
     */
    public void changePops(String name, String identifer, String category, String uri, String method, String description) {
        this.name = name;
        this.identifer = identifer;
        this.category = category;
        this.uri = uri;
        this.method = method;
        this.description = description;

    }

    public void disable() {
        this.enabled = false;
    }

}
